/*
	sample_comparisons.red
	
	This Scarlett program make some simple text comparisons, and counts the number of 
	successful comparisons
*/


// Declare a counter. Keeps track of the number of comparisons.
save 0 into i

// Save some text
save 'hi' into str1
save 'this' into str2
save 'a' into str3
save 'really' into str4
save 'what' into str5
save 'string' into str6
save 539 into str7
save 777 into str8
save '???' into str9
save '$' into str10
save 'email@test.com' into anEmail


show '\n'
show 'This displays the results of some comparisons :'
show '\n'



if str1 is smaller than str2 then
 
  show str1 
  show 'is smaller than : '
  show str2  

else

  show str2
  show 'is smaller than :  '
  show str1

end if



// Increment the counter by 1.
inc i

show '\n'



if str3 is same as str4 then

  show 'These strings are the same : '
  show str3  
    
else

 show 'These strings are NOT the same : '
 show str3
 show str4
  
end if

// Increment the counter by 1.
inc i
show '\n'


// Tests our regex type "number"
if str5 is a number then

  show 'This text is a number : '
  show str5  
    
else
  
  show 'This text is not a number : '
  show str5
   
    // nested if statement
    if str8 is a number then
    	show '...but this is :'
    	show str8
    end if

end if

// Increment the counter by 1.
inc i
show '\n'


// Show a nested if statement
if str7 is a number then

  show 'We like numbers : '
  show str7

else

  show 'sorry, str7 is not a number.'
  
end if

  
  
// Increment the counter by 1.
inc i

show '\n'



if str9 contains str10 then

  show str9
  show 'contains : '
  show str10  

else

  show str9
  show 'does NOT contain : '
  show str10
 
end if

  
// Increment the counter by 1.
inc i
show '\n'


if anEmail contains '@' then
	show 'anEmail variable contains an at sign'
	inc i
else
	show 'anEmail is not a email'
end if
  
  
show '\n'
show 'We made this many successful comparisons :'
show i




show '\n'
show 'done'
show '\n'

